package company.JM;

import leetcode.TreeNode;

import java.util.ArrayDeque;
import java.util.Queue;

public class JiMI1 {

    public int find(TreeNode root) {
        TreeNode ans = root;
        Queue<TreeNode> queue = new ArrayDeque<>();
        queue.add(root);
        while (!queue.isEmpty()) {
            ans = queue.poll();
            if (ans.left != null)
                queue.add(ans.left);
            if (ans.right != null)
                queue.add(ans.right);
        }
        return ans.val;
    }
}
